package com.tripwego.client.model;

import java.util.Date;

import com.google.gwt.i18n.client.DateTimeFormat;
import com.tripwego.shared.dto.DayDto;

public class DayModel {

	/**
	 * 
	 */
	private static int i = 0;

	private Long id;

	private Long etapeId;

	private Long etapeIdNext;

	private String name;

	private Date date;

	private String libelleDate;

	private Integer number;

	private boolean attacheAEtape;

	// public static int order = 1;

	/**
	 * 
	 */
	public DayModel(int number) {
		super();

		setId(new Long(i++));
		setName("Day " + number);
		this.number = number;
		// order++;
	}

	/**
	 * 
	 */
	public DayModel(DayDto dayDto) {
		super();

		setDate(dayDto.getDate());
		setId(dayDto.getId());
		setNumber(dayDto.getNumber());
		setEtapeId(dayDto.getEtapeId());
		setEtapeIdNext(dayDto.getEtapeIdNext());
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name
	 *            the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the libelleDate
	 */
	public String getLibelleDate() {
		return libelleDate;
	}

	/**
	 * @param libelleDate
	 *            the libelleDate to set
	 */
	public void setLibelleDate(String libelleDate) {
		this.libelleDate = libelleDate;
	}

	/**
	 * @return the date
	 */
	public Date getDate() {
		return date;
	}

	/**
	 * @param date
	 *            the date to set
	 */
	public void setDate(Date date) {
		this.date = date;

		DateTimeFormat dateTimeFormat = DateTimeFormat.getFormat("EEE, MMM d");
		setLibelleDate(dateTimeFormat.format(date));
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return name + " " + libelleDate;
	}

	/**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}

	/**
	 * @param id
	 *            the id to set
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * @return the number
	 */
	public Integer getNumber() {
		return number;
	}

	/**
	 * @param number
	 *            the number to set
	 */
	public void setNumber(Integer number) {
		this.number = number;
	}

	/**
	 * @return the attacheAEtape
	 */
	public boolean isAttacheAEtape() {
		return attacheAEtape;
	}

	/**
	 * @param attacheAEtape
	 *            the attacheAEtape to set
	 */
	public void setAttacheAEtape(boolean attacheAEtape) {
		this.attacheAEtape = attacheAEtape;
	}

	/**
	 * @return the etapeId
	 */
	public Long getEtapeId() {
		return etapeId;
	}

	/**
	 * @param etapeId
	 *            the etapeId to set
	 */
	public void setEtapeId(Long etapeId) {
		this.etapeId = etapeId;
	}

	/**
	 * @return the etapeIdNext
	 */
	public Long getEtapeIdNext() {
		return etapeIdNext;
	}

	/**
	 * @param etapeIdNext
	 *            the etapeIdNext to set
	 */
	public void setEtapeIdNext(Long etapeIdNext) {
		this.etapeIdNext = etapeIdNext;
	}

}
